package scantask.server.connection;

import com.thoughtworks.xstream.XStream;
import com.thoughtworks.xstream.io.xml.DomDriver;

import scantask.containers.operationStanzas.Stanza;

import scantask.server.domainLayer.Controller;
import scantask.server.domainLayer.ControllerInterface;

public class ConnectionHundler {
	
	private ControllerInterface _controller;
	
	public ConnectionHundler() {
		this._controller = new Controller();
	}
	
	public String doOperation(String operationXml) {
		XStream xstream = new XStream(new DomDriver());
		Stanza operation = (Stanza)xstream.fromXML(operationXml);
		String resultXml = operation.perform(this._controller);
		scantask.server.utilities.logging.SingletonLogger.getLogger().warning("Sending client " + resultXml);
		return resultXml;
	}

}
